package spms.data.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import spms.data.entity.Menu;
import spms.data.service.MenuService;
import spms.util.Page;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "Menu")
@RestController
public class MenuController {

    @Resource
    MenuService menuService;

    @ApiOperation(value = "查询所有菜单")
    @GetMapping("/menu/findAll")
    public List<Menu> findMenuAll() throws Exception {
        return menuService.findAll(Menu.class);
    }

    @ApiOperation(value = "分页查询菜单")
    @GetMapping("/menu/findPage")
    public Page<Menu> findMenuPage(@RequestParam Integer pageNum, @RequestParam Integer pageSize) throws Exception {
        return menuService.findPage(pageNum, pageSize, Menu.class);
    }
}
